RecordsService

Constructors

Link copied to clipboard
constructor(client: PocketbaseClient)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
inline suspend fun <T : BaseModel> _create(path: String, body: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
inline suspend fun <T : BaseModel> _create(path: String, body: Map<String, JsonPrimitive>, files: List<FileUpload>, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
Link copied to clipboard
inline suspend fun _delete(path: String, id: String): Boolean
Link copied to clipboard
inline suspend fun <T : BaseModel> _getFullList(path: String, batch: Int, sortBy: SortFields = SortFields(), filterBy: Filter = Filter(), expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields(), skipTotal: Boolean = false): List<T>
Link copied to clipboard
inline suspend fun <T : BaseModel> _getList(path: String, page: Int, perPage: Int, sortBy: SortFields = SortFields(), filterBy: Filter = Filter(), expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields(), skipTotal: Boolean = false): ListResult<T>
Link copied to clipboard
inline suspend fun <T : BaseModel> _getOne(path: String, id: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
Link copied to clipboard
inline suspend fun <T : BaseModel> _update(path: String, id: String, body: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
inline suspend fun <T : BaseModel> _update(path: String, id: String, body: Map<String, JsonPrimitive>, files: List<FileUpload>, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
Link copied to clipboard
inline suspend fun <T : AuthRecord> authWithOauth2(collection: String, provider: String, code: String, codeVerifier: String, redirectUrl: String, expandRelations: ExpandRelations = ExpandRelations(), fields: ShowFields = ShowFields()): AuthResponse<T>

Authenticate with an OAuth2 provider and returns a new auth token and record data. This action usually should be called right after the provider login page redirect. You could also check the OAuth2 web integration example.

Link copied to clipboard
inline suspend fun <T : AuthRecord> authWithOTP(collection: String, otpID: String, password: String, expandRelations: ExpandRelations = ExpandRelations(), fields: ShowFields = ShowFields()): AuthResponse<T>

Use the OTP password from the OTP email to log in Authenticate a single auth record with an one-time password (OTP).

Link copied to clipboard
inline suspend fun <T : AuthRecord> authWithPassword(collection: String, email: String, password: String, identityField: String? = null, expandRelations: ExpandRelations = ExpandRelations(), fields: ShowFields = ShowFields()): AuthResponse<T>

Authenticate a single auth record by their username/email and password.

Link copied to clipboard
open override fun baseCrudPath(collectionId: String): String

The url path to the service's API

Link copied to clipboard
fun basePath(collectionId: String): String
Link copied to clipboard
open suspend fun confirmEmailChange(collection: String, emailChangeToken: String, password: String): Boolean

Confirms email address change.

Link copied to clipboard
open suspend fun confirmPasswordReset(collection: String, passwordResetToken: String, password: String, passwordConfirm: String): Boolean

Confirms a password reset request and sets a new auth record password.

Link copied to clipboard
open suspend fun confirmVerification(collection: String, verificationToken: String): Boolean

Confirms an email address verification request.

Link copied to clipboard
inline suspend fun <T : BaseModel> create(sub: String, body: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
inline suspend fun <T : BaseModel> create(sub: String, body: Map<String, JsonPrimitive>, files: List<FileUpload>, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T

Creates a new record and gets the record

Link copied to clipboard
inline suspend fun delete(sub: String, id: String): Boolean

Deletes the specified record

Link copied to clipboard
inline suspend fun <T : BaseModel> getFullList(sub: String, batch: Int, sortBy: SortFields = SortFields(), filterBy: Filter = Filter(), expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields(), skipTotal: Boolean = false): List<T>

Fetches all records in the collection at once

Link copied to clipboard
inline suspend fun <T : BaseModel> getList(sub: String, page: Int, perPage: Int, sortBy: SortFields = SortFields(), filterBy: Filter = Filter(), expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields(), skipTotal: Boolean = false): ListResult<T>

Fetches a paged list of records

Link copied to clipboard
inline suspend fun <T : BaseModel> getOne(sub: String, id: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T

Fetches a single record

Link copied to clipboard
inline suspend fun <T : AuthRecord> impersonate(collection: String, id: String, duration: <Error class: unknown class>? = null, expandRelations: ExpandRelations = ExpandRelations(), fields: ShowFields = ShowFields()): AuthResponse<T>

Impersonate allows you to authenticate as a different user by generating a non-refreshable auth token.

Link copied to clipboard
open suspend fun listAuthMethods(collection: String, fields: ShowFields = ShowFields()): AuthService.AuthMethodsList

returns a public list with the allowed collection authentication methods

Link copied to clipboard
inline suspend fun <T : BaseModel> refresh(collection: String, expandRelations: ExpandRelations = ExpandRelations(), fields: ShowFields = ShowFields()): AuthResponse<T>

Returns a new auth response (token and user data) for already authenticated auth record. This method is usually called by users on page/screen reload to ensure that the previously stored data in pb.authStore is still valid and up-to-date.

Link copied to clipboard
open suspend fun requestEmailChange(collection: String, newEmail: String): Boolean

Sends an email change request for an authenticated record.

Link copied to clipboard
inline suspend fun <T : AuthRecord> requestOTP(collection: String, email: String): String

Requests an OTP email be sent Authenticate a single auth record with an one-time password (OTP).

Link copied to clipboard
open suspend fun requestPasswordReset(collection: String, email: String): Boolean

Sends a password reset email to a specified auth record email.

Link copied to clipboard
open suspend fun requestVerification(collection: String, email: String): Boolean

Sends auth record verification email request.

Link copied to clipboard
inline suspend fun <T : BaseModel> update(sub: String, id: String, body: String, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T
inline suspend fun <T : BaseModel> update(sub: String, id: String, body: Map<String, JsonPrimitive>, files: List<FileUpload>, expandRelations: ExpandRelations = ExpandRelations(), showFields: ShowFields = ShowFields()): T

Updates an existing records and gets it